package com.gs.SynPatrolRep.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewStub;

import com.gs.SynPatrolRep.R;
import com.gs.SynPatrolRep.adapter.base.BaseAdapter;
import com.gs.SynPatrolRep.adapter.base.BaseViewHolder;
import com.gs.SynPatrolRep.db.dto.PalBillEventDto;

import java.util.List;

public class PalBillEventAdapter extends BaseAdapter<PalBillEventDto> {

    public PalBillEventAdapter(Context context, List<PalBillEventDto> list, int layoutId) {
        super(context, list, layoutId);
    }

    @Override
    public void convert(BaseViewHolder holder, PalBillEventDto bean, final int position) {
        int levelType = bean.getLevelType();
        holder.setTextAndColor(R.id.tv_importance, bean.getLevelTypeName()+"*", levelType == 1 ? R.color.login_btn_bg : levelType == 2 ? R.color.yellow : R.color.blue);
        int state = bean.getPro();
        holder.setTextAndColor(R.id.tv_state,bean.getProName(),state == 0 ? R.color.red : state == 1 ? R.color.color_999 : R.color.color_a7);
        holder.setEventText(R.id.tv_num, bean.getEventNum() == null ? context.getString(R.string.nothing) : bean.getEventNum());
        holder.setEventText(R.id.tv_describe, bean.getName() == null ? context.getString(R.string.nothing) : bean.getName());
        holder.setEventText(R.id.tv_plan, bean.getRepAt() == null ? context.getString(R.string.nothing) : bean.getRepAt());
    }
}
